﻿/****公共js方法库****/
$.ajaxSetup({ cache: false });

//获取最高的一个zindex，提供给dialog和control调用，
var zindex = 100;
var getZIndex = function() { return zindex++; };

String.prototype.toInt = function() {
    return parseInt(this);
}
//字符串的长度，区分全角与半角
String.prototype.caseLength = function() {
    var self = this;
    var len = self.length;
    var caseLen = 0;
    for (var i = 0; i < len; i++) {
        if ((self.charCodeAt(i) & 0xff00) != 0) {
            caseLen++;
        }
        caseLen++;
    }
    return caseLen;
}

// 截取字符串长度，一个全角字符算两个长度
String.prototype.caseSubStr = function(start, len) {
    var self = this;
    var caseLen = 0;
    var l = 0;
    var tempLen = 0;
    var iStart = 0;
    var iLen = 0;
    for (var i = 0; i < self.length; i++) {
        tempLen = 0;
        if ((self.charCodeAt(i) & 0xff00) != 0) {
            caseLen++;
            tempLen++;
        }
        caseLen++;
        tempLen++;
        if (caseLen >= start) {
            if (iStart == null) iStart = i;
            l += tempLen;
            if (l >= len) {
                iLen = i - iStart + 1;
                break;
            }
        }
    }
    return this.substring(iStart, iLen);
}

//将字符串转换为float类型
String.prototype.toFloat = function() {
    return parseFloat(this);
}

//将日期字符串转换为日期类型，格式： 2010-11-5 16:00:00 
String.prototype.toDate = function() {
    var datePart = this.split(" ")[0];
    var temp = datePart.split("-");
    date = new Date(temp[0], temp[1] - 1, temp[2]);
    //date.setFullYear(temp[0]);
    //date.setMonth(temp[1]);
    //date.setDate(temp[2]);
    date.setHours(0);
    date.setMinutes(0);
    date.setSeconds(0);
    date.setMilliseconds(0);
    return date;
}

//去掉字符串的前后空格
// 2011-04-27 zhangyu update
// 将单个的replace方法拆分为 两次调用，可使每个正则表达式变得简单，因此更快
String.prototype.trim = function() {
    return this.replace(/^\s+/, "").replace(/\s+$/, "");
}

// 应用于比较长的字符串清空空格

// 2011-04-27  zhangyu  add
String.prototype.longTrim = function() {
    this.replace(/^\s+/, "");
    for (var i = this.length - 1; i >= 0; i--) {
        if (/\s/.test(this.charAt(i))) {
            this.substring(0, i + 1);
            break;
        }
    }
    return this;
}

// 字符串StringBuilder类
function StringBuilder() {
    this._strings = new Array();
}
StringBuilder.prototype.Append = function(value) {
    this._strings.push(value);
    return this;
}
StringBuilder.prototype.Clear = function() {
    this._strings.length = 1;
}
StringBuilder.prototype.toString = function() {
    return this._strings.join('');
}



// 通过自身的选中状态选中其它复选框
$.fn.checkBox = function(chk, table) {
    var checked = this.attr('checked');
    var inputCheckBoxs = !table ? $('input:not(:disabled)[type=checkbox][name="' + chk + '"]') : $(table).find('input:not(:disabled)[type=checkbox][name="' + chk + '"]');
    inputCheckBoxs.attr("checked", checked);
    refreshChecked(inputCheckBoxs, checked);
}

//检查自身的选中状态是否正确
$.fn.refreshCheck = function(table) {
    var c = this.data('checkBoxName');
    try {
        c.check();
    }
    catch (e) {
    }
    refreshChecked(!table ? $(this).closest('table').find(':checkbox') : $(table).find(':checkbox'), $(this).is(':checked'));
}

//给当前复先框绑定选中事件
$.fn.bindCheckBox = function(chk, containerName) {
    // 2011-04-29  zhangyu
    // 替换为checkBox click绑定匿名函数
    var con = $(containerName);

    $(this).click(function() {
        var _self = $(this);
        var checked = _self.attr('checked');
        var inputCheckBoxs = !containerName ? $('input:not(:disabled)[type=checkbox][name="' + chk + '"]') : con.find('input:not(:disabled)[type=checkbox][name="' + chk + '"]');
        inputCheckBoxs.attr("checked", checked);
        refreshChecked(inputCheckBoxs, checked);
    });
    var c =
    {
        checkbox: this,
        selector: chk,
        check: function() {
            var _self = c;
            var checked = 0, unchecked = 0;
            var checkBoxs = !containerName ? $('input[type="checkbox"][name="' + _self.selector + '"]') : con.find('input[type="checkbox"][name="' + _self.selector + '"]');
            for (var i = checkBoxs.length - 1; i >= 0; i--) {
                var el = $(checkBoxs[i]);
                if (el.attr('checked')) {
                    checked++;
                } else if (el.attr('disabled') != true) {
                    unchecked++;
                }
            }
            var allCheck = checked > 0 && unchecked == 0;
            _self.checkbox.attr('checked', allCheck);
            singleRefreshChecked($(this));
            // refreshChecked(checkBoxs);
        }
    };
    this.data('checkBoxName', c);
    (!containerName ? $('input[type="checkbox"][name="' + chk + '"]') : con.find('input[type="checkbox"][name="' + chk + '"]')).live('click', c.check);
}


//检查是否选定的指定的个数，min max 可以不指定
function checkSelected(name, containerName, min, max) {
    var checked = 0;
    var inputs = containerName ? $(containerName).find('input[name=' + name + ']') : $('input[name=' + name + ']');
    for (var i = inputs.length - 1; i >= 0; i--) {
        if ($(inputs[i]).attr('checked')) {
            checked++;
        }
    }
    if (min && checked < min) return false;
    if (max && checked > max) return false;
    if (min != -1 && checked < 1) return false;
    return true;
}

//jquery 插件
//绑定的文本框只能输入数字；                $("#txtOnlyNumber").onlyInputNumber();
//绑定的文本框输入小写字母自动转为大写；    $("#txtWord").autoUpper();
//绑定的文本框只能输入只定字符串；          $("#keyword").keyFileter("0123456789abcdefghijklmnopqrstuvwxyz_");
//绑定的文本框只能输入实数；                $("#keyword").keyFilterFloat();
jQuery.fn.extend(
{
    onlyInputNumber: function() {
        if (event.keyCode == 13) {
            return;
        }
        if ((event.keyCode >= 48 && event.keyCode <= 57)) {
            return;
        }
        event.preventDefault();
    },
    autoUpper: function() {
        this.keyup(function(event) {
            var s = $(this);
            s.val(s.val().toUpperCase());
        });
    },
    keyFileter: function(key) {
        this.keypress(function(event) {
            if (event.keyCode == 13) {
                return;
            }
            for (i = 0; i < key.length; i++) {
                if (event.keyCode == key.charCodeAt(i)) {
                    return;
                }
            }
            event.preventDefault();
        });
    },
    keyFilterFloat: function() {
        $(this).keypress(function(event) {
            var temp = $(this).val();
            if (event.keyCode == 13) {
                return;
            }
            if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode == 46 && temp.indexOf(".") == -1)) {
                return;
            }
            event.preventDefault();
        });
    }
})

//根据 property (传入的属性，如“dateTime”)来获取要进行处理的日期字段
//再从data数据（json格式）中统计出今天、昨天、更早以前数据
//today由外部传入，根据传入的today值进行比较
//返回值 {today:[],yesterday:[],past:[]}
//调用方法：
//var obj = $.stage(json,'2010-10-5',"dateTime");
jQuery.extend({
    stage: function(data, today, property) {
        if (today.constructor == String) {
            today = today.toDate();
        }
        var yestoday = new Date(today.getYear() < 1000 ? today.getYear() + 1900 : today.getYear(), today.getMonth(), today.getDate());
        var yyestoday = new Date(today.getYear() < 1000 ? today.getYear() + 1900 : today.getYear(), today.getMonth(), today.getDate());
        yestoday.setDate(yestoday.getDate() - 1);
        yyestoday.setDate(yyestoday.getDate() - 2);
        var week = new Array("本周日", "本周一", "本周二", "本周三", "本周四", "本周五", "本周六");
        //firefox下面getYeard在大于2000时返回的是1900后面的差值，所以要加1900
        var tempDate = new Date(today.getYear() < 1000 ? today.getYear() + 1900 : today.getYear(), today.getMonth(), today.getDate());
        var tempDate2 = new Date(today.getYear() < 1000 ? today.getYear() + 1900 : today.getYear(), today.getMonth(), today.getDate());
        tempDate2.setDate(tempDate2.getDate() - 1);
        tempDate.setDate(tempDate.getDate() + 7 - tempDate2.getDay());
        //alert((tempDate.getYear() + '-' + (tempDate.getMonth() + 1) + '-' + tempDate.getDate()));
        //alert((tempDate.getYear() < 1000 ? tempDate.getYear() + 1900 : tempDate.getYear())+'-'+ tempDate.getMonth()+'-'+ tempDate.getDate());
        //分组对象
        var dayArr = function(name, s, e) {
            var start = null;
            var end = null;
            //if (e)
            //{
            if (e) end = new Date(e.getYear() < 1000 ? e.getYear() + 1900 : e.getYear(), e.getMonth(), e.getDate());
            // if (s)
            //{
            if (s) start = new Date(s.getYear() < 1000 ? s.getYear() + 1900 : s.getYear(), s.getMonth(), s.getDate());
            // } else
            // {
            //      start = end;
            // }
            // }
            this.name = name;
            this.data = new Array();
            this.process = function(d, date) {
                if (date == null && (start == null && end == null)) {

                    this.data.push(d);
                    return true;
                }
                if ((start == null && end == null) || (date >= start && end == null) || (start == null && date <= end)
                    || (start != null && end != null && date >= start && date <= end)) {
                    //if (start) alert('start:' + (start.getYear() + '-' + (start.getMonth() + 1) + '-' + start.getDate()) + '    ' + (date.getYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()));
                    // if (end) alert('end:' + (end.getYear() + '-' + (end.getMonth() + 1) + '-' + end.getDate()) + '    ' + (date.getYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()));
                    this.data.push(d);
                    return true;
                }
                return false;
            }
        }
        //分组对象的数组
        var arr = new Array();
        //之后
        {
            var d = new dayArr('之后', tempDate, null);
            arr.push(d);
        }
        //本周
        for (var i = 7; i > 0; i--) {
            tempDate.setDate(tempDate.getDate() - (i > 0 ? 1 : 0));
            var name = null;
            if (tempDate.getDay() == today.getDay()) {
                name = '今天';
            } else if (tempDate.getDay() == yestoday.getDay()) {
                name = '昨天';
            } else if (tempDate.getDay() == yyestoday.getDay()) {
                name = '前天';
            } else {
                name = week[tempDate.getDay()];
            }
            var d = new dayArr(name, tempDate, tempDate);
            arr.push(d);
        }
        //上周
        {
            //tempDate.setDate(tempDate.getDate() - 7);
            var endDate = new Date(tempDate.getYear() < 1000 ? tempDate.getYear() + 1900 : tempDate.getYear(), tempDate.getMonth(), tempDate.getDate());

            endDate.setDate(tempDate.getDate() - 1);
            var name = '上周日';
            var d = new dayArr(name, endDate, endDate);
            arr.push(d);

            endDate.setDate(tempDate.getDate() - 7);
            name = '上周';
            d = new dayArr(name, endDate, tempDate);
            arr.push(d);
            //alert(tempDate.getYear() + '-' + (tempDate.getMonth() + 1) + '-' + tempDate.getDate());
            //alert(endDate.getYear() + '-' + (endDate.getMonth() + 1) + '-' + endDate.getDate());
        }
        //本月
        {
            var monthStart = new Date(today.getYear() < 1000 ? today.getYear() + 1900 : today.getYear(), today.getMonth(), 1);
            var monthEnd = new Date(today.getYear() < 1000 ? today.getYear() + 1900 : today.getYear(), today.getMonth(), 1);
            monthEnd.setMonth(monthEnd.getMonth() + 1, 1);
            monthEnd.setDate(monthEnd.getDate() - 1);
            //alert(monthStart.getYear() + '-' + (monthStart.getMonth() + 1) + '-' + monthStart.getDate() + ' : ' + monthEnd.getYear() + '-' + (monthEnd.getMonth() + 1) + '-' + monthEnd.getDate());
            var d = new dayArr('本月', monthStart, monthEnd);
            arr.push(d);
        }
        //一个月前
        {
            var d = new dayArr('一个月前', null, tempDate);
            arr.push(d);
        }

        //其它
        var other = new dayArr('其它', null, null);
        arr.push(other);


        for (var i = 0; i < data.length; i++) {
            var value = eval("data[i]" + "." + property);
            var temp = value.toDate();
            var date = null;
            if (temp) date = new Date(temp.getYear() < 1000 ? temp.getYear() + 1900 : temp.getYear(), temp.getMonth(), temp.getDate());
            for (var j in arr) {
                if (arr[j].process(data[i], date)) break;
            }
        }
        var o = new Array();
        for (var i in arr) {
            if (arr[i].data.length > 0) {
                o.push({ name: arr[i].name, data: arr[i].data });
            }
        }
        return o;
    }
});

//链接输入正动补全功能
(function($) {
    var protocols = ['http'];

    var createDiv = function(txt) {
        var val = txt.val();
        var div = $('<div style="position:absolute; cursor:pointer;border:#0000FF solid 1px;">');
        for (var i = 0; i < protocols.length; i++) {
            var opt = $('<div id="' + protocols[i] + '" style="height:25; text-align:left;padding:3px;">');
            opt.html(protocols[i] + '://' + val);
            if (i == 0) {
                opt.css('background-color', '#0099FF');
                //opt.attr('current', 'true');
            }
            opt.click(function() {
                var el = $(this);
                var text = el.html();
                var parent = el.parent();
                parent.data('txt').val(text);
                parent.hide();
            });
            div.append(opt);
        }
        div.data('txt', txt);
        div.moveNext = function() {
            var divs = this.find('div');
            var index = 0;
            for (var i = 0; i < divs.length; i++) {
                var el = $(divs[i]);
                if (el.attr('current') == 'true') {
                    index = i;
                }
                el.css('background-color', '#FFFFFF');
                el.attr('current', 'false');
            }
            index++;
            if (index > divs.length - 1) index = 0;
            $(divs[index]).css('background-color', '#0099FF')
            $(divs[index]).attr('current', 'true');
        };
        div.moveUp = function() {
            var divs = this.find('div');
            var index = 0;
            for (var i = 0; i < divs.length; i++) {
                var el = $(divs[i]);
                if (el.attr('current') == 'true') {
                    index = i;
                }
                el.css('background-color', '#FFFFFF')
                el.attr('current', 'false');
            }
            index--;
            if (index < 0) index = divs.length - 1;
            $(divs[index]).css('background-color', '#0099FF')
            $(divs[index]).attr('current', 'true');
        }

        div.update = function(text) {
            for (var i = 0; i < protocols.length; i++) {
                this.find('#' + protocols[i]).html(protocols[i] + '://' + text);
            }
            this.setSelect(0);
        };
        div.setValue = function() {
            var txt = this.data('txt');
            this.find('div').each(function() {
                var el = $(this);
                if (el.attr('current') == 'true') {
                    txt.val(el.html());
                }
            });
            this.hide();
        };
        div.showF = function() {
            if (this.is(':visible')) return;
            var txt = this.data('txt');
            var offset = txt.offset();
            var top = offset.top + txt.outerHeight();
            var left = offset.left;
            div.css({ left: left, top: top });
            this.setSelect(0);
            div.show();
        };
        div.setSelect = function(index) {
            var divs = this.find('div');
            for (var i = 0; i < divs.length; i++) {
                var el = $(divs[i]);
                if (i == index) {
                    el.css('background-color', '#0099FF')
                    el.attr('current', 'true');
                } else {
                    el.css('background-color', '#FFFFFF')
                    el.attr('current', 'false');
                }
            }
        }
        $('body').append(div);
        $('body').click(function() {
            div.hide();
        });
        div.hide();
        return div;
    }

    var checkProtocol = function(text) {
        var hasProtocol = false;
        for (var i = 0; i < protocols.length; i++) {
            var reg = new RegExp('^' + protocols[i] + '://.*', 'i');
            if (reg.test(text)) {
                hasProtocol = true;
                break;
            }
        }
        return hasProtocol;
    }

    $.fn.urlInput = function() {
        this.data('oldVal', this.val());
        this.keyup(function() {
            var el = $(this);
            var val = el.val();
            var div = el.data('div');
            if (val == '' || checkProtocol(val)) {
                try {
                    if (div) div.hide();
                } catch (e) { }
                return;
            }

            var e = $.event.fix(event);
            var oldVal = el.data('oldVal');

            if (!div) {

                div = createDiv(el);
                el.data('div', div);
            }
            div.showF();
            if (val != oldVal) {
                div.update(val);
                el.data('oldVal', val);
            }
            if (e.keyCode == 38) {
                div.moveUp();
            } else if (e.keyCode == 40) {
                div.moveNext();
            } else if (e.keyCode == 13) {
                div.setValue();
            }
        });
    }
})(jQuery);

//年月选择控件相关方法
function __resetYearMonth(change, cqjobFormat, enableYearOnly, obj) {
    var con = $(obj).parent();
    var hid = con.find('input[type=hidden]');
    var sel = con.find('select');
    var year = $(sel[0]).val();
    var month = $(sel[1]).val();
    if (year && month) {
        if (cqjobFormat) {
            hid.val(year + '/' + month);
        } else {
            hid.val(year + '-' + month + '-1');
        }
    } else if (year && enableYearOnly) {
        if (cqjobFormat) {
            hid.val(year);
        } else {
            hid.val(year + '-1-1');
        }
    } else {
        hid.val('');
    }
    if (change) {
        try {
            eval(change + '("' + hid.val() + '")');
        } catch (e) { }
    }
}

//检查个人用户是否登录，参数是登录成功后的回调函数
//如果没登录返回false并弹出登录界面
function checkPersonLogin(callback, onclose, hideTip) {
    var logined = true;
    $.ajax(
    {
        url: '/CommonHandles/PersonLoginCheck.ashx',
        dataType: 'json',
        async: false,
        success: function(json) { logined = json.isLogined; },
        error: function() { /*logined = false;*/ }
    });
    if (!logined && !($('#loginForm')[0])) {
        if (typeof onclose == 'boolean') {
            hideTip = onclose;
            onclose = null;
        }
        var url = '/PersonAjaxLogin.aspx?success=' + (callback || '') + (hideTip ? '&hideTip=true' : '');
        $.showModal(url, { title: '个人登录', animate: false, onclose: onclose });
    }
    return logined;
}

//检查单位用户是否登录，参数是登录成功后的回调函数
//如果没登录返回false并弹出登录界面
function checkCompanyLogin(callback, onclose) {
    var logined = true;
    $.ajax(
    {
        url: '/CommonHandles/CompanyLoginCheck.ashx',
        dataType: 'json',
        async: false,
        success: function(json) { logined = json.isLogined; },
        error: function() { /*logined = false;*/ }
    });
    if (!logined && !($('#loginForm')[0])) {
        var url = '/CompanyAjaxLogin.aspx?callback=' + (callback || '');
        $.showModal(url, { title: '单位登录', onclose: onclose });
    }
    return logined;
}

$.fn.bgIframe = $.fn.bgiframe = function(s) {
    //因发现ie7也出现这个问题，所以不管什么浏览器都加上
    //if ($.browser.msie && /6.0/.test(navigator.userAgent))
    try {
        s = $.extend({ top: 'auto', left: 'auto', width: 'auto', height: 'auto', opacity: true, src: 'javascript:void(0);'
        }, s || {});

        var prop = function(n) {
            return n && n.constructor == Number ? n + 'px' : n;
        };
        var width = this.outerWidth(true);
        var height = this.outerHeight(true);
        //var html = '<iframe class="bgiframe" frameborder="0"tabindex="-1"src="' + s.src + '"' + 'style="display:block;position:absolute;z-index:-1;' + (s.opacity !== false ? 'filter:Alpha(Opacity=\'0\');' : '') + 'top:' + (s.top == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')' : prop(s.top)) + ';' + 'left:' + (s.left == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')' : prop(s.left)) + ';' + 'width:' + (s.width == 'auto' ? 'expression(this.parentNode.offsetWidth+\'px\')' : prop(s.width)) + ';' + 'height:' + (s.height == 'auto' ? 'expression(this.parentNode.offsetHeight+\'px\')' : prop(s.height)) + ';' + '"/>';
        var html = this.find('.bgiframe');
        if (html.length > 0) {
            html.remove();
        }
        html = '<iframe class="bgiframe" frameborder="0" tabindex="-1"src="javascript:void(0)"' + 'style="display:block;position:absolute;z-index:-1;' + (s.opacity !== false ? 'filter:Alpha(Opacity=\'0\');' : '') + 'top:' + (s.top == 'auto' ? '0px' : prop(s.top)) + ';' + 'left:' + (s.left == 'auto' ? '0px' : prop(s.left)) + ';' + 'width:' + prop(width) + ';' + 'height:' + prop(height) + ';' + '"/>';
        this.prepend(html);
    } catch (e) { }
    return this;
};

//给一组复选框或单选框设置和获取值的快捷方法
//设置时传入数组或以','分割的字符串，返回一个数组
$.fn.checkValues = function(vals) {
    var valArr = null;
    if ($.isArray(vals)) {
        valArr = new Array();
        for (var i in vals) {
            valArr.push(vals[i].toString());
        }
    } else if (typeof vals == 'string') {
        valArr = vals.split(',');
    } else if (typeof vals == 'number') {
        valArr = new Array();
        valArr.push(vals.toString());
    }

    if (valArr) {
        for (var i = 0; i < this.length; i++) {
            var el = $(this[i]);
            var isIn = $.inArray(el.val(), valArr) >= 0;
            el.attr('checked', isIn);
        }
    }
    var v = new Array();
    for (var i = 0; i < this.length; i++) {
        var el = $(this[i]);
        if (el.attr('checked')) v.push(el.val());
    }
    return v;
};



var _pager_loading = null;
//显示数据正在加载中的窗口
function loading() {
    if (_pager_loading) {
        try {
            _pager_loading.close();
        } catch (e) { }
    }
    var html = '   <div class="tip_loading">' +
                 '           <span class="tip_loading_txt">数据正在载入中,请稍候</span>' +
                 ' </div>';

    var box = null;
    var left = 200;
    var top = 0;
    var menu = $('.nav');
    if (menu.count > 0) {
        var menuOffset = menu.offset();
        if ((menuOffset.top + menu.outerHeight()) > $(window).scrollTop()) {
            top = menuOffset.top + menu.outerHeight() - $(window).scrollTop();
        } else {
            top = 0;
        }
    }
    //var content = $('.content');
    left = 205 - (1440 - $('body').width()) / 2;
    box = $.anchor(html, { position: 'anchorRight', left: left, top: top, showBackground: false, showBorder: false, icon: '' });
    _pager_loading = box;
}
//关闭数据正在加载中的窗口
function stopLoading() {
    if (_pager_loading) {
        try {
            _pager_loading.close();
            _pager_loading = null;
        } catch (e) { }
    }
}

//滚动到数据列表的第一行
function scrollToFisrtRow() {
    var wnd = $(window);
    var tableHeaderTop = 0;
    var table = $('.getlist');
    if (table.length == 1) {
        tableHeaderTop = table.offset().top;
        if (wnd.scrollTop() > tableHeaderTop) {
            wnd.scrollTop(tableHeaderTop);
        }
    }
}

function bindTrHover(over, out, tableName) {
    var tab = tableName ? $(tableName) : $('.getlist');
    tab.find('tbody').find('tr:not(.thorough,.getlist_line)').unbind('mouseover').bind('mouseover', function() {
        $(this).addClass('conhov');
        if ($.isFunction(over)) {
            over.apply(this);
        }
    });
    tab.find('tbody').find('tr:not(.thorough,.getlist_line)').unbind('mouseout').bind('mouseout', function() {
        $(this).removeClass('conhov');
        if ($.isFunction(out)) {
            out.apply(this);
        }
    });
}
function unbindTrHover(tableName) {
    var tab = tableName ? $(tableName) : $('.getlist');
    tab.find('tbody').find('tr:not(.thorough,.getlist_line)').unbind('mouseover');
    tab.find('tbody').find('tr:not(.thorough,.getlist_line)').unbind('mouseout');
}
//清除高亮显示，可以指定表格
function clearHighLight(table) {
    if (typeof table == 'undefined') {
        table = $('.getlist');
    } else if (typeof table == 'string') {
        table = $(table);
    }
    if (table.length > 0) {
        for (var i = table.length - 1; i >= 0; i--) {
            $(table[i]).find('tr').removeClass('conhigh');
        }
    }
}
//将指定id的行高亮显示
function highLight(ids, table) {
    if (typeof ids == 'string') {
        if (ids == 'selected') {
            ids = new Array();
            $(':checkbox[checked]').each(function() {
                var chk = $(this);
                ids.push(chk.closest('tr').attr('id'));
            });
        } else {
            ids = ids.split(',');
        }
    }
    if (typeof table == 'undefined') {
        table = $('.getlist');
    } else if (typeof table == 'string') {
        table = $(table);
    }
    for (var i in ids) {
        try {
            if (ids[i]) table.find('#' + ids[i]).addClass('conhigh');
        } catch (e) { }
    }
}

function singleRefreshChecked(checkbox) {
    var el = checkbox;
    var tr = el.closest('tr');
    var next = tr.next('.details');
    if (el.attr('checked')) {
        // if (!tr.hasClass('concu')) 
        tr.addClass('concu');
        //if (next.hasClass('details'))
        next.addClass('concu');
        // tr.css('background',"red");
    } else {
        tr.removeClass('concu');
        //if (next.hasClass('details'))
        next.removeClass('concu');
        //tr.css('background',"white");
    }
}


//刷新选中的行的选中状态，以更新背景颜色
function refreshChecked(checkBoxs, isChecked) {
    var checks = checkBoxs;
    if (isChecked) {
        for (var j = checks.length - 1; j >= 0; j--) {
            var el = $(checkBoxs[j]);
            var tr = el.closest('tr');
            var next = tr.next('.details');
            tr.addClass('concu');
            next.addClass('concu');

        }
    }
    else {
        for (var j = checks.length - 1; j >= 0; j--) {
            var el = $(checkBoxs[j]);
            var tr = el.closest('tr');
            var next = tr.next('.details');
            tr.removeClass('concu');
            //if (next.hasClass('details'))
            next.removeClass('concu');
            //tr.css('background',"white");
        }
    }
}

//摘要显示列表
function tableList(parms, buildListFunc) {
    var cloneWorkExp = $('<div class="thorougt_exp" id="divWorkExperience"><label id="lblWorkYear"></label><label id="lblStation" class="strong"></label>&nbsp;<label id="lblWorkInCompany"></label><label id="lblSalaryMonth"></label><br /><label id="lblDesc"></label></div>');
    var cloneSummary = $('<div class="thorougt_con"><dl><dt id="dtSchool"></dt><dd><label id="lblSchool"></label><label id="lblProfessional"></label><label id="lblDegree"></label></dd></dl><div class="clear"></div><dl><dt id="dtDesc"></dt><dd id="feature"></dd></dl><div class="clear"></div><dl><dt id="dtSalaryExp"></dt><dd id="ddSalaryExp"></dd></dl><div class="clear"></div><dl><dt id="dtWorkExp"></dt><dd id="work"></dd></dl><div class="clear"></div></div>');
    //默认值
    //listButton 列表显示按钮，summaryButton 摘要显示按钮，summarySelector 摘要选择器
    //tbody 显示列表的容器，cloneSummary 摘要DOM对象，data 显示的数据，isGroup 是否需要分组显示    
    var _defaultValue = { tableID: 'searchList', isListMode: true, listButton: '#btnList', summaryButton: '#btnAbstract', summarySelector: '.thorough', tbody: '#content', summaryBody: '.thorough', data: 'undefined', arrSort: [], isGroup: false };
    var content = $.extend(_defaultValue, parms);
    var isListMode = content.isListMode;
    var tbody = $(content.tbody);
    var summaryBody = content.summaryBody;
    var colspan = $(summaryBody).find('td').attr('colspan');
    var _self = this; // Zy 
    var currentSortPro = undefined; // 指定当前的排序属性

    //摘要与列表切换显示
    var switchShowSummaryAndList = function() {
        /*
        if ($.browser.opera)
        {
        $(content.listButton).removeAttr('click');
        }
        var onclick = $(content.listButton).attr('click');
        if (typeof onclick != 'function')
        {
        }
        */
        $(content.listButton).click(function() {

            $(this).addClass('list_cu');
            $(content.summaryButton).removeClass('abstract_cu');
            $(content.summarySelector).hide();
            isListMode = true;
        });

        $(content.summaryButton).click(function() {
            $(this).addClass('abstract_cu');
            $(content.listButton).removeClass('list_cu');
            $(content.summarySelector).show();
            isListMode = false;
        });
    }


    // 2011-06-28 ZhangYu add  sortTable method


    //  转换函数
    var convert = function(sValue, sType) {
        switch (sType) {
            case "int":
                return parseInt(sValue);
            case "date":
                return new Date(Date.parse(sValue));
            default:
                return sValue.toString();
        }
    }

    // 比较函数
    var generateCompareTRs = function(property, type, arrSort, filter) {

        return function(x, y) {
            var xValue;
            var yValue;
            if (filter && typeof filter != 'undefined') {
                // 过滤数据
                xValue = convert(filter.exec(eval('x.' + property)), type);
                yValue = convert(filter.exec(eval('y.' + property)), type);
            }
            else {
                xValue = convert(eval('x.' + property), type);
                yValue = convert(eval('y.' + property), type);
            }
            if (arrSort && typeof arrSort != "undefined" && arrSort.length > 0) {
                // 按指定的数据排序进行排序
                var sortString = arrSort.toString();
                var xIndex = sortString.indexOf(xValue);
                var yIndex = sortString.indexOf(yValue);
                if (xIndex < yIndex) {
                    return -1;
                } else if (xIndex > yIndex) {
                    return 1;
                } else {
                    return 0;
                }
            }
            else {
                if (xValue < yValue) {
                    return -1;
                } else if (xValue > yValue) {
                    return 1;
                } else {
                    return 0;
                }
            }
        }
    }

    //  排序
    var sortTable = function(property, type, arrSort, filter) {
        var data = Array.apply(this, content.data);
        if (currentSortPro && currentSortPro == property) {
            data.reverse();
        }
        else {
            data.sort(generateCompareTRs(property, type, arrSort, filter));
        }
        currentSortPro = property;
        content.data = data;
    }


    // 提示排序操作

    var promptSort = function(params) {
        $('#divPromptSort').remove();
        var p = $('#' + content.tableID).position();
        var left = p.left + 5;
        var top = p.top - 50;
        //设置层的位置
        $('<div class="firsttips" id="divPromptSort"><div class="firsttips_c"><div class="firsttips_close"><a href="javascript:void(0)" id="btnHidePromptSort" title="我知道了"></a></div><div class="firsttips_arrow_bottom"></div><div class="firsttips_con">点击部分有箭头标识的类目对搜索出的简历进行排序，找到合适的人才将变得更加容易喔！</div></div></div>').appendTo('body');
        $('#divPromptSort').css('left', left).css('top', top).show().bgIframe();
        //设置隐藏层的事件
        $('#btnHidePromptSort').click(function() {
            $('#divPromptSort').hide();
        });
    }

    //添加数据到数据区
    var append = function(row, name) {
        if (typeof buildListFunc != 'function') {
            return;
        }
        var summary = summaryBody.clone();
        summary.find('td').append(cloneSummary.clone());
        var id = row.UID; //在后台生成一个统一的ID号调用方式为 row.UID
        var summaryData = eval('(' + row.summary + ')');
        summary.attr('id', 'summary' + id);
        if (typeof summaryData.school != "undefined" && summaryData.school != '') {
            $('#dtSchool', summary).html('毕业院校：');
            $('#lblSchool', summary).html(summaryData.school);
            $('#lblProfessional', summary).html(summaryData.professional);
            $('#lblDegree', summary).html(summaryData.degreeName);
        }
        else {
            $('#dtSchool', summary).parent('dl').remove();
        }
        if (summaryData.feature != undefined && summaryData.feature != '') {
            $('#dtDesc', summary).html('特点概述：');
            $('#feature', summary).html(summaryData.feature);
        }
        else {
            $('#dtDesc', summary).parent('dl').remove();
        }

        $('#dtSalaryExp', summary).html("期望薪资：");
        var temp = '<label>' + summaryData.summary_salary_exp + '</label>';
        if (summaryData.salary_year != undefined && summaryData.salary_year != '') {
            temp = temp + '<label>目前年薪：' + summaryData.salary_year + '</label>';
        }
        $('#ddSalaryExp', summary).html(temp);

        $('#dtWorkExp', summary).html('工作经验：');
        //处理工作经验
        var workExp;
        var work = eval(summaryData.work);
        if (work != undefined && work != null && work != '') {
            for (var j = 0; j < work.length; j++) {
                workExp = cloneWorkExp.clone();
                if (work[j].workCompany.caseLength() > 40) {
                    work[j].workCompany = work[j].workCompany.caseSubStr(0, 40) + '...';
                }
                if (work[j].station.caseLength() > 30) {
                    work[j].station = work[j].station.caseSubStr(0, 30) + '...';
                }
                if (work[j].desc.caseLength() > 300) {
                    work[j].desc = work[j].desc.caseSubStr(0, 300) + '...';
                }
                var salaryMonth = '';
                if (work[j].salary_month != undefined && work[j].salary_month != null) {
                    salaryMonth = work[j].salary_month;
                }
                $('#lblWorkYear', workExp).html(work[j].time);
                $('#lblWorkInCompany', workExp).html(work[j].workCompany);
                $('#lblStation', workExp).html(work[j].station);
                $('#lblSalaryMonth', workExp).html(work[j].salary_month);
                $('#lblDesc', workExp).html(work[j].desc);
                if (work.length - 1 == j) {
                    workExp.css('border', '0');
                }
                $('#work', summary).append(workExp);
            }

            if (work.length == 0) {
                $('#dtWorkExp', summary).parent('dl').remove();
            }
        }
        else {
            $('#dtWorkExp', summary).parent('dl').remove();
        }
        var tr;
        if (content.isGroup == true && name != undefined && name != null && name != '') {
            tr = $(buildListFunc(row, name)).attr('group', name);
            tbody.append(tr);
        }
        else {
            tbody.append(buildListFunc(row));
        }
        tbody.append(summary);
        tbody.append('<tr id="trLine' + id + '" class="getlist_line"><td colspan="' + colspan + '"></td></tr>');
    }

    //生成列表的方法
    this.build = function() {
        switchShowSummaryAndList();
        var rows = content.data;
        for (var i = 0, count = rows.length; i < count; i++) {
            if (content.isGroup == true) {
                var header = $('<tr class="_trheader" groupName=' + rows[i].name + '><td colspan="' + colspan + '" class="data_expand"><h4>' + rows[i].name + '(<span class="groupNumber">' + rows[i].data.length + '</span>)</h4></td></tr>');
                tbody.append(header);
                for (var j = 0, k = rows[i].data.length; j < k; j++) {
                    append(rows[i].data[j], rows[i].name);
                }
            }
            else {
                append(rows[i]);
            }
        }
        if (isListMode) {
            $(content.summarySelector).css('display', 'none');
            $(content.listButton).addClass('list_cu');
            $(content.summaryButton).removeClass('abstract_cu');
        }
        else {
            $(content.summarySelector).css('display', '');
            $(content.summaryButton).addClass('abstract_cu');
            $(content.listButton).removeClass('list_cu');
        };
        var trs = tbody.find('tr.rowcontent').has(':checkbox');
        for (i = 0, j = trs.length; i < j; i++) {
            var item = $(trs[i]);
            item.find(':checkbox').click(function() {
                if ($(this).attr('checked')) {
                    var left = 0;
                    if (isIE) {
                        left = $(this).offset().left + 17;
                    }
                    else {
                        left = $(this).offset().left + 15;
                    }

                    var top = $(this).offset().top + 2;
                    $(this).parent().find('a').css({ 'display': 'inline', 'position': 'absolute', 'left': left, 'top': top });
                }
                else {
                    $(this).parent().find('a').css({ 'display': 'none' });
                }
            }).parent().find('a').attr('title', '查看所选');
        }
    }

    //提供一个删除后的刷新方法  刷新分组的记录数，如果删除了分组中的所有数据，那么删除分组头部
    this.refreshList = function() {
        var trGroups = tbody.find('tr[groupName]');
        for (var i = 0, j = trGroups.length; i < j; i++) {
            var item = $(trGroups[i]);
            var groupName = item.attr('groupName');
            var count = tbody.find('tr[group=' + groupName + ']').length;
            if (count > 0) {
                item.find('span.groupNumber').html(count);
            }
            else {
                $(this).remove();
            }
        }
    }


    // 表头排序事件初始化
    this.init = function(arrSort) {
        if (!arrSort || typeof arrSort == "undefined" || arrSort.length <= 0) return;
        //promptSort();
        $('#' + content.tableID).find('th').find('b').removeClass('uplst downlst').removeAttr('clickNum').unbind();
        $.each(arrSort, function(i, item) {
            /*
            $('#searchList').find("#"+item.name).bind('click',function()
            {
            tbody.empty();
            sortTable(item.property,item.type,item.sort,item.filter);
            _self.build();
            $.listToggleSelected({tbody:tbody});
            })
            */
            /*
            $('#'+content.tableID).find("#"+item.name).find('b').toggle(function(){
            $('#'+content.tableID).find('thead b').removeClass('uplst downlst');
            $(this).removeClass('uplst').addClass('downlst');
            tbody.empty();
            sortTable(item.property,item.type,item.sort,item.filter);
            _self.build();
            $.listToggleSelected({tbody:tbody});
                      
            },function(){
            $('#'+content.tableID).find('thead b').removeClass('uplst downlst');
            $(this).removeClass('downlst').addClass('uplst');
            tbody.empty();
            sortTable(item.property,item.type,item.sort,item.filter);
            _self.build();
            $.listToggleSelected({tbody:tbody});   
            });
            */

            $('#' + content.tableID).find("#" + item.name).find('b').click(function() {
                $(this).closest('th').siblings().find('b').removeClass('uplst downlst').removeAttr('clickNum');
                if (typeof $(this).attr('clickNum') == "undefined" || $(this).attr('clickNum') == '0') {
                    $(this).removeClass('uplst').addClass('downlst');
                    $(this).attr('clickNum', '1')
                }
                else {
                    $(this).removeClass('downlst').addClass('uplst');
                    $(this).attr('clickNum', '0')
                }
                var height = $(window).scrollTop();
                tbody.empty();
                sortTable(item.property, item.type, item.sort, item.filter);
                _self.build();
                $(window).scrollTop(height);
                $.listToggleSelected({ tbody: tbody });
                return false;
            });

        })
    }
    _self.init(content.arrSort);
}

//过滤字符串中的html文本
$.extend(
{
    filterHTML: function(str) {
        if (str == 'undefined' || str == null || str == '' || str.constructor != String) {
            return '';
        }
        return str.replace(/<.*?>/g, function(match) { return match.replace('<', '').replace('>', ''); });
    }
});


//设置按钮状态为正在运行状态
$.fn.running = function(msg, opt) {
    this.enable(false);
    if ($.isPlainObject(msg)) {
        opt = msg;
        msg = null;
    }
    msg = msg || '正在处理，请稍候';
    opt = $.extend({}, opt);
    opt.type = 'dialog';
    opt.position = 'auto';
    opt.dependElement = this;
    opt.contentType = 'html';
    opt.content = '<div class="tip_loading_sml"><span class="tip_loading_txt">' + msg + '</span></div>';
    //opt.animate = 'fade';
    opt.showHeader = false;
    opt.showBorder = false;
    opt.showBackground = false;
    opt.draggable = false;
    opt.showButton = false;
    opt.id = new Date().getTime();
    var box = $.dialog(opt);
    box.show();
    this.data('running', box);
    return box;
}

//恢复正在运行状态的按钮为正常状态
$.fn.stopRunning = function() {
    var running = this.data('running');
    try {
        running.close();
    } catch (e)
    { }
    finally {
        this.enable(true);
    }
}
// 是否是ie浏览器

var isIE = $.browser.msie;


$.extend(
{
    listToggleSelected: function(parms) {
        var _default = { tbody: '#content', esys: '.esys' }
        var names = $.extend(_default, parms);
        var esysLeft = isIE ? 17 : 15;
        var tbody = $(names.tbody);
        var rows = tbody.find('tr.rowcontent');
        for (var i = rows.length - 1; i >= 0; i--) {
            var item = $(rows[i]);
            var trDetail = item.next('tr');
            var func = (function(item, trDetail) {
                return function() {
                    //item.addClass('conhov');
                    //trDetail.addClass('conhov');
                    item.css('backgroundColor', '#ffffe1');
                    trDetail.css('backgroundColor', '#ffffe1');
                    var selected = item.find('input[type=checkbox]:checked');
                    if (selected.length > 0) {
                        var point = selected.offset();
                        var left = point.left + esysLeft;
                        var top = point.top + 2;
                        item.find(names.esys).css({ 'display': 'inline', 'position': 'absolute', 'left': left, 'top': top });
                    }
                    // event.stopPropagation();                    
                }
            })(item, trDetail);

            var funcleave = (function(item, trDetail) {
                return function() {
                    $(item).css('backgroundColor', '').find(names.esys).css('display', 'none');
                    $(trDetail).css('backgroundColor', '');
                    // event.stopPropagation();
                }
            })(item, trDetail);
            item.mouseover(
            func
            /*function(event)
            {
            
            $(this).addClass('conhov');//conhov
            
            var detail=$(this).next('tr');
            
            detail.addClass('conhov');
            var selected = $(this).find('input[type=checkbox]:checked');
            if (selected.length > 0)
            {
            var left = 0;
            var point=selected.offset();
            left = point.left + esysLeft;
            var top = point.top + 2;
            $(this).find(names.esys).css({ 'display': 'inline', 'position': 'absolute', 'left': left, 'top': top });           

            } 
            }*/).mouseout(
            funcleave
            /*
            function(event)
            {
            $(this).removeClass('conhov').find(names.esys).css('display', 'none');
            $(this).next('tr').removeClass('conhov');
            }*/);


            if (trDetail.length > 0) {
                trDetail.mouseenter(
                func
                /*function()
                {
                $(this).addClass('conhov');
                var content=$(this).prev('tr').addClass('conhov');
                var selected = content.find('input:checked');
                if (selected.length > 0)
                {
                var left = 0;
                var point=selected.offset();
                left = point.left+esysLeft;
                var top = point.top + 2;
                content.find(names.esys).css({ 'display': 'inline', 'position': 'absolute', 'left': left, 'top': top });
                }
                }*/).mouseleave(
                funcleave
                /*function(event)
                {
                $(this).removeClass('conhov');
                var content=$(this).prev().removeClass('conhov').find(names.esys).css('display', 'none');
                }*/);

            }

        }
    }
});

//查看简历
//self 是当前事件触发的对象，operate 是显示简历的类型，比如查看邀请的简历为 invite
function showSelectedResume(self, parms) {
    var _default = { tbody: '#content', operate: 'invite' };
    var show = $.extend(_default, parms);
    $(self).attr('href', 'javascript:void(0)').removeAttr('target');
    var selected = $(show.tbody).find('input:checked');
    if (selected.length > 0) {
        var IDs = '';
        if (show.operate == 'recycle') {
            var checkedRec = $('#tdyContent').find('input:checked');
            $.each(checkedRec, function(i, n) {
                if (i == checkedRec.length - 1) {
                    IDs += 'recID=' + $(n).val().split('|')[0];
                }
                else {
                    IDs += 'recID=' + $(n).val().split('|')[0] + '&';
                }
            });
        }
        else {
            IDs = selected.fieldSerialize();
        }
        $(self).attr('href', '/Company/Resuming/ResumeBatchShow.aspx?operate=' + show.operate + '&' + IDs).attr('target', '_blank');
    }
    else {
        $.anchorMsg('请选择需要查看的简历', { icon: 'warning' }); return;
    }
}

//照片显示插件
function showPhoto(node, photo, hdPhoto) {
    var el = $(node);

    var doc = $(document);
    var wnd = $(window);
    var offset = el.offset();
    var top = 0;
    var left = 0;
    var fix = 2;
    var isHd = false;
    var toTop = function(el, con) {
        top = offset.top - con.height() - fix - 3;
        left = offset.left + el.width() + fix;
        if (left + con.outerWidth() > wnd.scrollLeft() + wnd.width()) {
            left -= left + con.outerWidth() - wnd.scrollLeft() - wnd.width();
        }
        return top >= wnd.scrollTop();
    }

    var toBottom = function(el, con) {
        top = offset.top + el.height() + fix;
        left = offset.left - con.outerWidth() - fix;
        if (left < wnd.scrollLeft()) {
            left += wnd.scrollLeft() - left;
        }
        return top + con.outerHeight() <= wnd.scrollTop() + wnd.height();
    }
    //定位
    var pos = function(el, con) {
        //如果是高清照直接定位在左边
        if (isHd) {
            top = offset.top;
            left = offset.left - con.outerWidth();
        } else {
            if (!toTop(el, con)) toBottom(el, con);
        }
        con.css({ top: top, left: left, 'z-index': getZIndex() });
        con.show();
    }

    if (hdPhoto) {
        var hdImg = $('img[src=' + hdPhoto + ']');
        if (hdImg.length > 0) {
            isHd = true;
            pos(el, hdImg.closest('div'));
            return;
        }
    } else {
        var norImg = $('img[src=' + photo + ']');
        if (norImg.length > 0) {
            pos(el, norImg.closest('div'));
            return;
        }
    }
    var src = null;
    var width = 0;
    var height = 0;
    if (hdPhoto) {
        isHd = true;
        src = hdPhoto;
        width = 240;
        height = 300;
    } else if (photo) {
        src = photo;
        width = 120;
        height = 150;
    }
    var img = $('<div class="" style="position:absolute;top:-1000px;left:-1000px;"><img src="' + src + '"/></div>');
    var div = $('<div style="position:absolute;overflow:hidden;" class="floatlayer_pic"></div>');
    div.append(img);
    div.css({ width: width + 4, height: height + 4 });
    div.appendTo('body');
    var failNotify = setTimeout(function() {
        div.addClass(isHd ? 'floatlayer_error2' : 'floatlayer_error').html('照片加载失败');
    }, 10000);
    img.find('img').load(function() {
        clearTimeout(failNotify);
        $(this).closest('div').css({ left: 0, top: 0 });
        $(this).closest('div').parent().bgIframe();
    });
    pos(el, div);
    el.mouseout(function() {
        div.hide();
    });
}

//检查浏览器是否支持fixed样式
$.support.fixed = !document.all || document.all && document.compatMode == "CSS1Compat" && window.XMLHttpRequest;

//重写window.close函数以便火狐也能关闭
var _windowClose = window.close;
window.close = function() {
    window.opener = null;
    window.open("", '_self', "");
    _windowClose();
    try {
        $.anchorMsg('如果窗口没有关闭，请手动关闭窗口', { icon: 'warning' });
    } catch (e) { }
}
/*
//临时的测试反馈界面
$(document).ready(function()
{
var _test = $('<div style="position:absolute;z-index:60;"><a id="_feedbackDiv" href="javascript:void(0)" onclick="" class="feedbackbtn">说说我的使用感受</a></div>').appendTo('body');
var wnd = $(window);
var doc = $(document);
var toCenter = function()
{
var left = 0;
var top = wnd.scrollTop() + (wnd.height() - _test.height()) / 2;
_test.css({ left: left, top: top });
};

if ($.support.fixed)
{
var left = 0;
var top = (wnd.height() - _test.height()) / 2;
_test.css({ position: 'fixed', left: left, top: top });
} else
{
// wnd.scroll(toCenter).resize(toCenter);
toCenter();
}
_test.find('#_feedbackDiv').click(function()
{
_test.hide();
$.showModal('/Feedback.aspx', { title: '使用感受反馈', onclose: function()
{
_test.show();
}
});
return false;
});
	
//    _test.find('#_feedbackClose').click(function()
//    {
//        _test.hide();
//        if (!$.support.fixed)
//        {
//            wnd.unbind('scroll', toCenter).unbind('resize',toCenter);
//        }
//    });
});
*/
// 写Cookie
function writeCookie(name, value) {
    var expire = new Date();
    expire.setFullYear(expire.getFullYear() + 20);
    expire = '; expires=' + expire.toGMTString();
    document.cookie = name + '=' + escape(value) + expire;
}

// 读取Cookie
function readCookie(name) {
    var cookieValue = '';
    var search = name + '=';
    if (document.cookie.length > 0) {
        var offset = document.cookie.indexOf(search)
        if (offset != -1) {
            offset += search.length;
            var end = document.cookie.indexOf(';', offset);
            if (end == -1) end = document.cookie.length;
            cookieValue = unescape(document.cookie.substring(offset, end));
        }
    }
    return cookieValue;
}

//定位强调摘要显示
function stressAbstract(parms) {
    $('#divStressAbstract').remove();
    var defaultParms = { name: 'btnAbstract' };
    var btn = $.extend(defaultParms, parms);
    var display = readCookie("displayStressAbstract");
    if (display == 'false') {
        return;
    }
    var p = $('#' + btn.name).position();
    var left = p.left + 5;
    var top = p.top - 50;
    //设置层的位置
    $('<div class="firsttips" id="divStressAbstract"><div class="firsttips_c"><div class="firsttips_close"><a href="javascript:void(0)" id="btnHideStressAbstract"></a></div><div class="firsttips_arrow_bottom"></div><div class="firsttips_con">摘要模式更好用哦，试试看？</div></div></div>').appendTo('body');
    $('#divStressAbstract').css('left', left).css('top', top).show().bgIframe();
    //设置隐藏层的事件
    $('#btnHideStressAbstract').click(function() {
        writeCookie('displayStressAbstract', 'false');
        $('#divStressAbstract').hide();
    });
}

//强调菜单位置
function stressMenu() {
    $('#divStressMenu').remove();
    var display = readCookie("displayStressMenu");
    if (display == 'false') {
        return;
    }
    var p = $('.nav_three').find('span').position();
    var left = 605; //p.left;
    var top = p.top - 37;
    //设置层的位置
    $('<div class="firsttips" id="divStressMenu"><div class="firsttips_c"><div class="firsttips_close"><a href="javascript:void(0)" id="btnHideStressMenu"></a></div><div class="firsttips_arrow_top"></div><div class="firsttips_con"><div class="firsttips_txt">操作菜单跑到这里来了，试试看</div></div></div></div>').appendTo('.content');
    $('#divStressMenu').css('left', left).css('top', top).show();
    //设置隐藏层的事件
    $('#btnHideStressMenu').click(function() {
        writeCookie('displayStressMenu', 'false');
        $('#divStressMenu').hide();
    });
}
